import vue from 'vue'
import vuex from 'vuex'

vue.use(vuex)

const store = new vuex.Store({
    state:{
        index:0,
        shoppingindex:1,
        shopping:{
            img:[],
            content:[],
            price:[]
        }
        
    },
    mutations:{
        indexadd(state){
           state.index++;
        },
        scrollTitle(state){
            state.index=0;
        },
        shopping(state,obj){
            state.shoppingindex=1;
            if(state.shopping.img.indexOf(obj.good[obj.parm][0].list[obj.index].imgs)!=-1 &&
            state.shopping.content.indexOf(obj.detailsGoods[obj.parm].detail[obj.index])!=-1 &&
            state.shopping.price.indexOf(obj.good[obj.parm][0].list[obj.index].price)!=-1){
              
            }else{
                state.shopping.img.push(obj.good[obj.parm][0].list[obj.index].imgs);
                state.shopping.content.push(obj.detailsGoods[obj.parm].detail[obj.index]);
                state.shopping.price.push(obj.good[obj.parm][0].list[obj.index].price);
        }
            }
           
    }
})

export default store